<?php
namespace Home\Controller;
use Think\Controller;
class CmtController extends Controller {
    public function index(){
	  $shows_cmt = D('shows_cmt');
	  $id = I('get.shows_id');
	  $where['shows_cmt.shows_id'] = $id;
	  $data = $shows_cmt -> join('users on shows_cmt.users_id = users.users_id','left')
						 -> field('shows_cmt.id as cmt_id,shows_cmt.cmt,shows_cmt.time,users.name,users.pic')
						 -> where($where)
						 -> select();
	  $this->assign(array(
            'list'        => $data
            ));
	  $this->display();
    }

    function del(){
		$shows_cmt = D('shows_cmt');
		$id = I('get.cmt_id');
		$de = $shows_cmt->where("id='$id'")->delete();
		$json = array('success' =>$de);
        echo json_encode($json);
    }
}
